package com.erp.servlet;

import com.erp.bean.ReportForms;
import com.erp.service.ReportFormService;
import com.erp.util.factroy.ObjectFactory;
import com.erp.vo.ReportFormsViewObject;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

/**
 * @author lpy
 * 财务信息列表控制器
 */
@WebServlet("/reportformlist.action")
public class ReportformListServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //创建财务报表业务对象
        ReportFormService formService = ObjectFactory.getServiceInstance("com.erp.service.impl.ReportFormServiceImpl", ReportFormService.class);
        List<ReportFormsViewObject> formsViewObjects = formService.findAll();
        //将集合信息存入request中
        req.setAttribute("formviews",formsViewObjects);
        //转发到页面显示
        req.getRequestDispatcher("reportformlist.jsp").forward(req,resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        this.doGet(req, resp);
    }
}
